package com.bocomm.tracevisualization.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.bocomm.tracevisualization.api.vo.BaseEntityVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 每次traceroute请求的结果数据
 * </p>
 *
 * @author cxp
 * @since 2024-03-20
 */
@Data
public class TraceTargetData {


    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 源端网络ip
     */
    private String sourceIp;

    /**
     * 源端网络名称
     */
    private String sourceHostName;


    /**
     * 目标网络ip
     */
    private String targetIp;
    /**
     * 目标网络host
     */
    private String targetHostName;

    /**
     * 是否成功执行
     */
    private boolean isSuccess;

    /**
     * 延迟时间（ms）
     */
    private Double delayTime;

    /**
     * 监控发生时间
     */
    private Long traceTime;

    /**
     * 监控结果
     */
    private Double traceResult;

    /**
     * command指令
     */
    private String commandLine;

    private String jobId;

    private Long commandCost;


    public TraceTargetData() {
    }

    public TraceTargetData(Traceroute traceroute) {

        this.sourceIp = traceroute.getSourceIp();

        this.sourceHostName = traceroute.getSourceHost();


        this.targetIp = traceroute.getTargetIp();

        this.targetHostName = traceroute.getTargetHost();

        this.commandLine = traceroute.getCommandLine();
        this.commandCost = traceroute.getCommandCost();
    }
}
